package com.xcm.service.impl;

import com.xcm.dao.ProgramDownloadMapper;
import com.xcm.model.TbProgramDownload;
import com.xcm.service.ProgramDownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 节目下载信息Service实现类
 */
@Service(value = "programDownloadService")
public class ProgramDownloadServiceImpl implements ProgramDownloadService {
	@Autowired
	private ProgramDownloadMapper programDownloadMapper;
	/**
	 * 保存节目下载信息
	 *
	 * @param programDownload TbProgramDownload对象
	 */
	@Override
	@Transactional(readOnly = false, rollbackFor = Exception.class)
	public void saveProgramDownload(TbProgramDownload programDownload) {
		programDownloadMapper.saveProgramDownload(programDownload);
	}

	/**
	 * 更新节目下载信息
	 *
	 * @param programDownload TbProgramDownload对象
	 */
	@Override
	@Transactional(readOnly = false, rollbackFor = Exception.class)
	public void updateProgramDownload(TbProgramDownload programDownload) {
		programDownloadMapper.updateProgramDownload(programDownload);
	}

	/**
	 * 通过mac地址获取节目下载信息
	 *
	 * @param mac mac地址
	 * @return  TbProgramDownload对象
	 */
	@Override
	public TbProgramDownload getProgramDownloadByMac(String mac) {
		return programDownloadMapper.getProgramDownloadByMac(mac);
	}
}
